<h3>selected report options</h3>
<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'reports-form',
	'enableAjaxValidation'=>false,
        )
); ?>
<div id="floatingbar">
    <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array('class'=>'ui-button ui-widget ui-state-default ui-corner-all','style'=>'width:120px')); ?>
</div>
    
    <?php echo $form->errorSummary($model); ?>

    <fieldset class="box">
        <legend>Basic</legend>
        <table>
            <tr class="row">
                <td width="170px">
                    <?php echo $form->labelEx($model,'name'); ?>
                </td>
                <td>
                    <?php echo $form->textField($model,'name',array('size'=>55,'maxlength'=>100)); ?>
                    <?php echo $form->error($model,'name'); ?>
                </td>
            </tr>
            <tr class="row">
                <td>
                    <?php echo $form->labelEx($model,'description'); ?>
                </td>
                <td>
                    <?php echo $form->textArea($model,'description',array('rows'=>3, 'cols'=>53)); ?>
                    <?php echo $form->error($model,'description'); ?>
                </td>
            </tr>
            <tr class="row">
                <td>
                    <?php echo $form->labelEx($model,'org_id'); ?>
                </td>
                <td>
                    <?php

                    $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
                       //'model'=>$model,
                       'name'=>'org_id',
                       'value'=>CHtml::encode(Organisation::model()->findByPK($model->org_id)->nachname),
                       'source' => $this->createUrl('Organisation/autocompleteOrganisation'),
                       'options' => array(
                            'minLength'=>'2',
                            'select'=>"js:function(event,ui){
                                $('#".CHtml::activeId($model,'org_id')."').val(ui.item.id);
                            }",
                       ),
                    ));

                    ?>

                    <?php echo $form->hiddenField($model,'org_id'); ?>
                    <?php echo $form->error($model,'org_id'); ?>

                    &nbsp;&nbsp;&nbsp;&nbsp;<?php echo $form->labelEx($model,'type'); ?>&nbsp;&nbsp;
                    <?php echo $form->dropdownList($model,'type',array('1'=>'Mail','2'=>'Print','3'=>'Web')); ?>
                    <?php echo $form->error($model,'type'); ?>
                    
                </td>
            </tr>
        </table>
    </fieldset>

    <fieldset class="box">
        <legend>QlikView</legend>
        <table>
            <tr class="row">
                <td width="170px">
                    <?php echo $form->labelEx($model,'ber_docName'); ?>
                </td>
                <td>
                    <?php echo $form->textField($model,'ber_docName',array('size'=>55,'maxlength'=>150)); ?>
                    <?php echo $form->error($model,'ber_docName'); ?>
                </td>
            </tr>
            <tr class="row">
                <td>
                    <?php echo $form->labelEx($model,'rep_id'); ?>
                </td>
                <td>
                    <?php
                    echo $form->dropdownList($model,'rep_id',
                        CHtml::listData(Reportids::model()->findAll("rep_docName = :rep_docName AND rep_deleted = 0",array(':rep_docName'=>strtoupper($model->ber_docName))),'rep_id','rep_label')
                    ); ?>
                    <?php echo CHtml::ajaxButton('load Reports',
                        CController::createUrl('loadReports'),
                        array(
                                'type'=>'POST',
                                'update'=>'#Reports_rep_id',
                             ),
                        array(
                                'class'=>'button',
                             )
                        ); ?>

                        <?php echo CHtml::ajaxButton('load Fields',
                            CController::createUrl('//qvmapping/loadFields'),
                            array(
                                    'type'=>'POST',
                                    'data'=>array('Qvmapping[qvm_docName]'=>$this->ber_docName),
                                    'update'=>'#Qvfilters_qvf_id',
                                 ),
                            array(
                                    'class'=>'button',
                                 )
                        ); ?>
                    <?php echo $form->error($model,'rep_id'); ?>
                </td>
            </tr>
        </table>
    </fieldset>

    <fieldset class="box">
        <legend>Timing</legend>
        <table>
            <tr class="row">
                <td width="170px">
                    <?php echo $form->labelEx($model,'s_zyklus'); ?>
                </td>
                <td>
                    <?php echo $form->dropdownList($model,'s_zyklus',array('1'=>'daily','2'=>'weekly','3'=>'monthly')); ?>
                    <?php echo $form->error($model,'s_zyklus'); ?>

                    &nbsp;&nbsp;&nbsp;&nbsp;<?php echo $form->labelEx($model,'s_zyklus_start'); ?>&nbsp;&nbsp;
                    <?php echo $form->textField($model,'s_zyklus_start',array('size'=>2,'maxlength'=>2)); ?>
                    <?php echo $form->error($model,'s_zyklus_start'); ?>
                </td>
            </tr>
            <tr class="row">
                <td>
                    <?php echo $form->labelEx($model,'s_zyklus_time'); ?>
                </td>
                <td>
                    <?php
                        $this->widget('application.extensions.timepicker.timepicker',
                            array(
                                'model'=>$model,
                                'name'=>'s_zyklus_time',
                                'options'=>array(
                                    'hourGrid'=>4,
                                    'minuteGrid'=>10
                                )
                            )                            
                        );
                    ?>
                    
                    <?php echo $form->error($model,'s_zyklus_time'); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?php echo $form->labelEx($model,'s_zyklus_gap'); ?>
                </td>
                <td>
                    <?php
                        echo CHtml::activeCheckBoxList($model,'tblWeekdays',
                                    CHtml::listdata(Weekdays::model()->findAll(),'weekday_id','day'),
                                    array(
                                        'template' => '<div class="check-option">{input} {label}</div>',
                                        'separator' => '',
                                   )
                                );
                    ?>
                    <?php echo $form->error($model,'s_zyklus_gap'); ?>
                </td>
            </tr>
        </table>
    </fieldset>

    <fieldset class="box">
        <legend>Mail</legend>
        <table>
            <tr class="row">
                <td width="170px">
                    <?php echo $form->labelEx($model,'mail_subject'); ?>
                </td>
                <td>
                    <?php echo $form->textField($model,'mail_subject',array('size'=>58,'maxlength'=>100)); ?>
                    <?php echo $form->error($model,'mail_subject'); ?>
                </td>
            </tr>
            <tr class="row">
                <td>
                    <?php echo $form->labelEx($model,'mail_body'); ?>
                </td>
                <td>
                    <?php
                        $this->widget('application.extensions.cleditor.ECLEditor',array(
                                'model'=>$model,
                                'attribute'=>'mail_body',
                                'value'=>$model->mail_body,
                            )
                        );
                    ?>
                    <?php echo $form->error($model,'mail_body'); ?>
                </td>
            </tr>
        </table>
    </fieldset>

		<?php echo $form->hiddenField($model,'cdate'); ?>
		<?php echo $form->error($model,'cdate'); ?>

		<?php echo $form->hiddenField($model,'production_time'); ?>
		<?php echo $form->error($model,'production_time'); ?>

<p class="note">Fields with <span class="required">*</span> are required.</p>

		

<?php $this->endWidget(); ?>

</div><!-- form -->
